// src/services/storage.js
import { openDB } from 'idb';

export async function addDiary(diary) {
  const db = await openDB('my-database', 1, { upgrade(db) { db.createObjectStore('diaries', { keyPath: 'id', autoIncrement: true }); } });
  await db.add('diaries', diary);
}

export async function getDiaries() {
  const db = await openDB('my-database', 1);
  return db.getAll('diaries');
}
